package top.codedance.iotp.server.net.handle.subhandle;

import cd.io.netty.handler.codec.http.FullHttpRequest;
import top.codedance.iotp.server.ServerApplication;
import top.codedance.iotp.server.net.handle.WsChannelHandler;
import top.codedance.iotp.server.net.handle.WsMsgHandler;
import cd.io.netty.channel.ChannelHandlerContext;
import cd.io.netty.handler.codec.http.websocketx.*;
import org.apache.log4j.Logger;

public class BinaryWsMsgHandler implements WsMsgHandler {

    private static Logger logger = ServerApplication.getLogger(BinaryWsMsgHandler.class);

    public void channelRead(WsChannelHandler wsChannelHandler, String clientId, ChannelHandlerContext channelHandlerContext, FullHttpRequest request, byte[] msg) throws Exception {
        //此处待完善真正的功能
        String message = "收到二进制消息：" + new String(msg);
        wsChannelHandler.sendByteArrayMessage(message);
    }
}
